package cn.cs.service;

import cn.cs.mapper.ComplaintMapper;
import cn.cs.mapper.ComplaintTitleMapper;
import cn.cs.pojo.Complaint;
import cn.cs.pojo.ComplaintTitle;
import cn.cs.pojo.CsPerson;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class ComplaintService {

    @Resource
    private ComplaintMapper complaintMapper;

    @RequestMapping(value = "/getComplaintUserById", method = RequestMethod.POST)
    public Complaint getComplaintUserById(@RequestParam("id") String id)throws Exception{
        return complaintMapper.getComplaintById(id);
    }

    @RequestMapping(value = "/getComplaintByPhone", method = RequestMethod.POST)
    public List<Complaint> getComplaintByPhone(@RequestParam("userId") String userId)throws Exception{
        return complaintMapper.getComplaintByPhone(userId);
    }

    @RequestMapping(value = "/getComplaintListByMap", method = RequestMethod.POST)
    public List<Complaint> getComplaintListByMap(@RequestBody Map<String, Object> param)throws Exception{
        return complaintMapper.getComplaintListByMap(param);
    }

    @RequestMapping(value = "/getComplaintCountByMap", method = RequestMethod.POST)
    public Integer getComplaintCountByMap(@RequestBody Map<String, Object> param)throws Exception{
        return complaintMapper.getComplaintCountByMap(param);
    }

    @RequestMapping(value = "/itriptxAddComplaint", method = RequestMethod.POST)
    public Integer itriptxAddComplaint(@RequestBody Complaint complaint)throws Exception{
        return complaintMapper.insertComplaint(complaint);
    }

    @RequestMapping(value = "/itriptxModifyComplaint", method = RequestMethod.POST)
    public Integer itriptxModifyComplaint(@RequestBody Complaint complaint)throws Exception{
        return complaintMapper.updateComplaint(complaint);
    }

    @RequestMapping(value = "/itriptxDeleteComplaintById", method = RequestMethod.POST)
    public Integer itriptxDeleteComplaintById(@RequestParam("id") Long id)throws Exception{
        return complaintMapper.deleteComplaintById(id);
    }

    @RequestMapping(value = "/getAgentByRepairUserId", method = RequestMethod.POST)
    public Map<String, Object> getAgentByRepairUserId(@RequestParam("id") String id) throws Exception{
        return complaintMapper.getAgentByRepairUserId(id);
    }

    @RequestMapping(value = "/getAgentABByRepairUserId", method = RequestMethod.POST)
    public Map<String, Object> getAgentABByRepairUserId(@RequestParam("id") String id) throws Exception{
        return complaintMapper.getAgentABByRepairUserId(id);
    }

    @RequestMapping(value = "/getAgentABByOrderId", method = RequestMethod.POST)
    public Map<String, Object> getAgentABByOrderId(@RequestParam("id") String id) throws Exception{
        return complaintMapper.getAgentABByOrderId(id);
    }

    @RequestMapping(value = "/getAgentABByAppOrderId", method = RequestMethod.POST)
    public Map<String, Object> getAgentABByAppOrderId(@RequestParam("id") String id) throws Exception{
        return complaintMapper.getAgentABByAppOrderId(id);
    }

}
